<template>
  <section class="main">
    <div class="glass" :style="{ '--i': 1 }">
      <div class="inner">
        <div class="liquid"></div>
      </div>
    </div>
    <div class="glass" :style="{ '--i': 2 }">
      <div class="inner">
        <div class="liquid"></div>
      </div>
    </div>
    <div class="glass" :style="{ '--i': 3 }">
      <div class="inner">
        <div class="liquid"></div>
      </div>
    </div>
  </section>
  <div id="text" style="margin: -20px; font-size: 16px; display: flex; justify-content: center;">
    <TextHover text="May the code be with you" />
  </div>
</template>

<script>
import TextHover from '@/views/common/TextHover.vue'

export default {
  name: 'LiquidGlass',
  components: {
    TextHover
  }
}
</script>

<style scoped>
.main {
  margin: 20vh auto;
  min-width: 1300px;
}
*::after,
*::before {
  box-sizing: border-box;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  scroll-behavior: smooth;
}

body {
  background: #111;
  display: flex;
  min-height: 100vh;
  overflow: hidden;
  position: relative;
}

section {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  gap: 50px;
}

.glass {
  position: relative;
}

.glass .inner {
  position: relative;
  width: 200px;
  height: 400px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 40px;
  border: 8px solid transparent;
  animation: animateColor 5s linear infinite;
  animation-delay: calc(var(--i) * -1.25s);
}

@keyframes animateColor {
  0% {
    filter: hue-rotate(0deg);
  }
  100% {
    filter: hue-rotate(360deg);
  }
}

.glass .inner::before {
  content: '';
  position: absolute;
  width: calc(100% - 10px);
  height: 30px;
  border: 10px solid #444;
  border-radius: 50%;
  top: -15px;
  left: 50%;
  transform: translateX(-50%);
  box-shadow: 0 15px 0 #222;
}

.glass .inner::after {
  content: '';
  position: absolute;
  width: 50px;
  height: 250px;
  top: 80px;
  left: 30px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

.liquid {
  position: absolute;
  top: 50px;
  left: 5px;
  right: 5px;
  bottom: 1px;
  background: #41c1fb;
  border-bottom-left-radius: 30px;
  border-bottom-right-radius: 30px;
  filter: drop-shadow(0 0 80px #41c1fb);
  animation: animateLiquid 5s linear infinite;
  animation-delay: calc(var(--i) * -1.25s);
}

@keyframes animateLiquid {
  0%,
  20% {
    top: 50px;
  }
  50%,
  70% {
    top: 320px;
  }
  100% {
    top: 50px;
  }
}

.liquid::before {
  content: '';
  position: absolute;
  width: 100%;
  height: 20px;
  border-radius: 50%;
  background: #1fa4e0;
  top: -10px;
}
</style>
